#ifndef REPORT_GENERATOR_H
#define REPORT_GENERATOR_H

#include <vector>
#include <string>

// Forward declarations (avoids including full headers in this .h file)
namespace MiniBanking
{
    class Transaction;
    class Customer;
    class BankAccount;
}

namespace MiniBanking
{

    /**
     * @brief Generates various transaction reports and saves them to files.
     *
     * Provides static methods to create global, customer-specific, and
     * account-specific transaction reports.
     */
    class ReportGenerator
    {
    private:
        /**
         * @brief Writes a list of transactions to a specified file.
         * Assumes the transactions are already filtered and sorted appropriately.
         * @param filename The name of the file to write to.
         * @param reportTitle The title to put at the top of the report.
         * @param transactions The list of transactions to write.
         * @return True if writing was successful, false otherwise.
         */
        static bool writeTransactionsToFile(const std::string &filename,
                                            const std::string &reportTitle,
                                            const std::vector<Transaction> &transactions);

    public:
        // Delete constructor - this class is only meant for static methods
        ReportGenerator() = delete;

        /**
         * @brief Generates a global transaction report containing all transactions.
         * Transactions are sorted chronologically.
         * Filename format: transactions_YYYY-MM-DD.txt
         * @param allTransactions A vector containing all transactions in the system.
         * @return The filename of the generated report, or an empty string on failure.
         */
        static std::string generateGlobalReport(const std::vector<Transaction> &allTransactions);

        /**
         * @brief Generates a transaction report for a specific customer.
         * Includes transactions from all accounts belonging to the customer, sorted chronologically.
         * Filename format: transactions_<CUSTOMER_NAME>_YYYY-MM-DD.txt
         * @param customer The customer for whom to generate the report.
         * @param allTransactions A vector containing all transactions in the system (for filtering).
         * @return The filename of the generated report, or an empty string on failure.
         */
        static std::string generateCustomerReport(const Customer &customer,
                                                  const std::vector<Transaction> &allTransactions);

        /**
         * @brief Generates a transaction report for a specific bank account.
         * Includes only transactions involving the specified account, sorted chronologically.
         * Filename format: transactions_<ACCOUNT_ID>_YYYY-MM-DD.txt
         * @param account The bank account for which to generate the report.
         * @param allTransactions A vector containing all transactions in the system (for filtering).
         * @return The filename of the generated report, or an empty string on failure.
         */
        static std::string generateAccountReport(const BankAccount &account,
                                                 const std::vector<Transaction> &allTransactions);
    };

} // namespace MiniBanking

#endif // REPORT_GENERATOR_H
